$(document).ready(function(){
	var validator = $("#frmAddCountry").validate({
		
		errorElement:'div',
		rules: {
			countryname: {
				required: true,
				character:true,
				remote:SITEROOT+'/admin/country/checkcountryexist.php'
			},
			ciso_code: {
				required: true,
				character:true,
				maxlength: 3,
			}			
		},
		messages: {
			countryname: {
				required: "Please enter country name",
				character: "Please enter characters only",
				remote: jQuery.format("Country name already in use")
			},
			ciso_code: {
				required: "Please enter iso code ",
				character: "Please enter characters only",
				maxlength: jQuery.format("Enter at most {0} characters")
			}
		}
	
		});
	
	
	var validator = $("#frmEditCountry").validate({
		
		errorElement:'div',		
		rules: {
			
			countryname: {
				required: true,		
				character:true,	
				remote:SITEROOT+'/admin/country/checkcountryexist.php?id='+$("#country_id").val()
			},
			ciso_code: {
				required: true,
				character:true,
				maxlength: 3,
			}			
		},
		messages: {
			countryname: {
				required: "Please enter country name",
				character: "Please enter characters only",
				remote: jQuery.format("Country name already in use")				
			},
			ciso_code: {
				required: "Please enter iso code ",
				character: "Please enter characters only",
				maxlength: jQuery.format("Enter at most {0} characters")
			}
		}
	
		});
	
	
});